From: Brion Vibber Date: Tue, 7 Jun 2011 17:56:40 +0000 (+0000) Subject: Added phpunit test cases for r87497, r88076: ResourceLoader module name prefix collapsing X-Git-Tag: 1.31.0-rc.0~29634 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=315ac38cd6f5d3f467b893669967ac20c391c61e;p=lhc%2Fweb%2Fwiklou.git Added phpunit test cases for r87497, r88076: ResourceLoader module name prefix collapsing --- diff --git a/tests/phpunit/includes/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoaderTest.php index 76f0ba874c..30a69c5e2c 100644 --- a/tests/phpunit/includes/ResourceLoaderTest.php +++ b/tests/phpunit/includes/ResourceLoaderTest.php @@ -46,6 +46,40 @@ class ResourceLoaderTest extends PHPUnit_Framework_TestCase { $resourceLoader->register( $name, $module ); $this->assertEquals( $module, $resourceLoader->getModule( $name ) ); } + + /** + * @dataProvider providePackedModules + */ + public function testMakePackedModulesString( $desc, $modules, $packed ) { + $this->assertEquals( $packed, ResourceLoader::makePackedModulesString( $modules ), $desc ); + } + + /** + * @dataProvider providePackedModules + */ + public function testexpandModuleNames( $desc, $modules, $packed ) { + $this->assertEquals( $modules, ResourceLoaderContext::expandModuleNames( $packed ), $desc ); + } + + public function providePackedModules() { + return array( + array( + 'Example from makePackedModulesString doc comment', + array( 'foo.bar', 'foo.baz', 'bar.baz', 'bar.quux' ), + 'foo.bar,baz|bar.baz,quux', + ), + array( + 'Example from expandModuleNames doc comment', + array( 'jquery.foo', 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ), + 'jquery.foo,bar|jquery.ui.baz,quux', + ), + array( + 'Regression fixed in r88706 with dotless names', + array( 'foo', 'bar', 'baz' ), + 'foo,bar,baz', + ) + ); + } } /* Stubs */